<div class="page">
 {include file="lib/search_pager.html"}
	<div class="items" id="setpage">
  	<select>
  		<option value="1">1</option>
  		<option value="2">2</option>
  		<option value="3">3</option>
  		<option value="4">4</option>
  		<option value="5">5</option>
  		<option value="6">6</option>
  		<option value="7">7</option>
  		<option value="8">8</option>
  		<option value="9">9</option>
  		<option value="10">10</option>
  		<option value="11">11</option>
  		<option value="12">12</option>
  		<option value="13">13</option>
  		<option value="14">14</option>
  		<option value="15">15</option>
  	</select>
  	<span>Items per page</span>
  </div>
</div>
<script type="text/javascript" charset="utf-8">
$('#setpage select').val({$page_size});
</script>

<div id="advanced_search_content" class="advanced_search_content">
	<div class="advanced_search_list_topbg"></div>
{foreach $data as $val}

<div class="advanced_search_list{if $val@iteration < 4 && $val.is_recommend} advanced_search_list_on{/if}">
    {if $val@first && $val.is_recommend}
    <img alt="Close" src="images/close_icon.png" onclick="$('.advanced_search_list_on').hide();$(this).hide()" style="float: right; margin-right: 28px; margin-top: 10px; cursor: pointer;z-index:9999" width="16" height="16">
    {/if}
	<div class="advanced_search_listcontent">
		<h3>
		    {if $val@iteration < 4 && $val.is_recommend}<div class="tip"><span>FEATURED</span></div>{/if}
		    <a href="asset/{$val.id}.html">{$val.title}</a>
		</h3>
		<dl class="clearfix">
			<dt> <a href="asset/{$val.id}.html"><img height="67" width="80" src="{$val.img}"></a> </dt>
			<dd class="type">
				<ul>
					<li><span>Date added: </span>{date('M. d, Y', $val.add_time)}</li>
					{foreach $val.set_tags as $v}
					<li><span>{$v.tag_name}: </span>{foreach $v.tags as $k}{if !$k@first}, {/if}{$k.tag_name}{/foreach}</li>
					{/foreach}
					<li><span>Downloads: </span>{$val.download_num}</li>
					<li><span>Views: </span>{$val.view_num}</li>
				</ul>
				<div value="0" class="star_blue" style="position: relative;">
					<ul class="studyplay_starBg" style="width: 75px;">
						<li id="studyplay_current" style="width: {15*round($val.vote_value/$val.vote_num)}px; z-index: 0;" class="studyplay_starovering"></li>
					</ul>
				</div>
			</dd>
			<dd class="description">
				<p><span>Description: </span>{$val.description}</p>
			</dd>
		</dl>
		<div class="download_cart_btn">
			<ul class="clearfix">
				<li><a href="#" class="tg_download button_download">download</a></li>
        <li><a href="asset/{$val.id}.html" class="button_i">i</a></li>
        <li><a href="#" class="button_share" onclick="share_link(SITE_URL+'/asset/{$val.id}.html');return false">share</a></li>
			</ul>
		</div>
		<div style="display: none;" class="assetPanel">
		  {if $val.version}
			<h2>
				<div class="tip"><span>LATEST</span></div>
				{$val.version.version_name}(released {date('M Y', $val.version.update_time)})</h2>
			<table>
				<tbody>
					<tr>
						<th align="left" width="20" valign="middle"><input type="checkbox" checked="checked" class="ckall" /></th>
						<th align="left" width="340">File Name</th>
						<th width="150">Language</th>
						<th width="80">Size</th>
						<th width="60">File Type</th>
						<th width="100">Add date</th>
					</tr>
					{foreach $val.version.files as $v}
					<tr>
						<td align="left" valign="middle"><input type="checkbox" value="{$v.id}" name="downfile" checked="checked" size="{$v.file_size}"></td>
						<td align="left"><a href="download.html?id={$v.id}">{$v.file_name}</a></td>
						<td>{$v.language}</td>
						<td class="size_format">{$v.file_size}</td>
						<td>{$v.ext}</td>
						<td>{date('Y-m-d', $v.add_time)}</td>
					</tr>
					{/foreach}
				</tbody>
			</table>
			<div class="download_cart_btn">
				<ul>
					<li><a href="#" class="button_download download_btn">download</a></li>
          <li><a href="#" class="button_shop">down shop</a></li>
          <li><a href="#" class="button_share download_share">share</a></li>
				</ul>
			</div>
			{/if}
		</div>
	
	
	
	</div>
</div>
{/foreach}
<script type="text/javascript" charset="utf-8">
$('.tg_download').toggle(function(){
  $(this).removeClass('button_download').addClass('button_cancel').html('cancel');
  $(this).parents('.download_cart_btn').next().show();
  
  return false;
}, function(){
  $(this).removeClass('button_cancel').addClass('button_download').html('download');
  $(this).parents('.download_cart_btn').next().hide();
  
  return false;
});

$('.ckall').click(function(){
  var p = $(this).parents('tbody');
  $('input[name=downfile]', p).attr('checked', $(this).attr('checked'));
});

$('.size_format').html(function(i,html){
  return size_format(html);
});

$('.button_shop').click(function(){
  var p = $(this).parents('.assetPanel').find('input[name=downfile]:checked');
  if (p.size() == 0) {
    show_msg('you must choose files');
    return false;
  }
  var id = [];
  p.each(function(){
    id.push(this.value);
  });

  location.href = '/queue/add.html?id='+id.join(',');
  return false;
  
});

$('.download_btn').click(function(){
  var p = $(this).parents('.assetPanel').find('input[name=downfile]:checked');
  if (p.size() == 0) {
    show_msg('you must choose files');
    return false;
  }
  var id = [];
  var size = [];

  p.each(function(){
    id.push(this.value);
    size.push($(this).attr('size'));
  });

  downloadfile(id, size.sum());
  return false;
});

$('.download_share').click(function(){
  var p = $(this).parents('.assetPanel').find('input[name=downfile]:checked');
  if (p.size() == 0) {
    show_msg('you must choose files');
    return false;
  }
  var id = [];
  p.each(function(){
    id.push(this.value);
  });
  share_link(SITE_URL+'/download.html?id='+id.join(','));

  return false;
});

</script>

	<div class="advanced_search_list_bottombg"></div>
</div>

<div class="page">
  {include file="lib/search_pager.html"}
</div>